<%@ page language="java" pageEncoding="UTF-8"%>


<div class="control-group">
	<table>
		<tbody>
			<tr>
				<td width="10%">推送消息：<input type="text" id="msg" /></td>
				<td width="10%">测试token：<input type="text" id="token" value="5f456c931ca2d25c2429855a55e2c6292cd2008f5e0f72e4f68a07c4e01e30f5" /></td>
				<td width="10%"><input type="button" onclick="push()" value="推送测试" /></td>
				<td width="10%"><input type="button" onclick="pushAllQ()" value="正式推送" /></td>
				<td width="15%"><span id="error" style="color:red"></span></td>
			</tr>
		</tbody>
	</table>
</div>
<style>
.text-right {
	text-align: right;
	width: 8%;
	padding-right: 2px;
}

td {
	padding: 10px;
}

input.radio-margin0 {
	margin: 0;
}

#title {
	margin: 0;
	width: 50%;;
}

#abs {
	height: 60px;
	width: 52%;
}

#detail {
	height: 240px;
	width: 90%;
}

span {
	padding: 0 10px 0 5px;
	vertical-align: middle;
}

.inputsize {
   height: 16px;
   width: 90px;
}
.halfinputsize {
   height: 16px;
   width: 45px;
}

</style>

<script type="text/javascript">
function push()
{
	$.ajax({
		url:"push/push.do",
		type:"GET",
		data:{"msg":$("#msg").val(),"token":$("#token").val()},
		dataType: "json",
		cache: false,
		success:function(data){
			status = data["status"];
			
			if(status == 0){
				document.getElementById("error").innerHTML="发送成功";
				return;
			} else
				document.getElementById("error").innerHTML=data["msg"];
		},
		error:function(XMLHttpRequest,textStatus, errorThrown){
			// error here... do something...
			document.getElementById("error").innerHTML="未知错误，请稍后重试！";
		}
	});
}

function pushAllQ()
{
	document.getElementById("error").innerHTML="发送中.......";
	$.ajax({
		url:"push/pushAll.do",
		type:"GET",
		data:{"msg":$("#msg").val()},
		dataType: "json",
		cache: false,
		success:function(data){
			status = data["status"];
			
			if(status == 0 || status == "0"){
				document.getElementById("error").innerHTML="发送成功";
				return;
			} else
				document.getElementById("error").innerHTML=data["msg"];
		},
		error:function(XMLHttpRequest,textStatus, errorThrown){
			// error here... do something...
			document.getElementById("error").innerHTML="未知错误，请稍后重试！";
		}
	});
}
</script>

